class Animal {
    constructor(name) {
      this.name = name;
    }
  
    speak() {
      console.log(`${this.name} makes a sound.`);
    }
  }
  
  class Dog extends Animal {
    constructor(name, breed) {
      // super可以接多个参数，，例如vpa里有段是这样写的：super(props)
      super(name);
      this.breed = breed;
    }
  
    speak() {
      console.log(`${this.name} barks.`);
    }
  }
  
  const myDog = new Dog("Buddy", "Golden Retriever");
  myDog.speak(); // 输出：Buddy barks.